package com.youku.plugins.commonui.view.noticeCard
{
   import flash.display.Sprite;
   import flash.display.DisplayObject;
   import flash.text.TextField;
   import com.youku.utils.DrawUtil;
   import com.youku.plugins.commonui.CommonUIConstant;
   import com.youku.utils.AssetUtil;
   import flash.text.TextFormat;
   import com.youku.skin.YaheiFontManager;
   
   public class BaseNoticeCard extends Sprite
   {
      
      public function BaseNoticeCard() {
         super();
         this.init();
      }
      
      protected var _screenBackground:Sprite;
      
      protected var _card:Sprite;
      
      protected var _background:Sprite;
      
      protected var _noticeIcon:DisplayObject;
      
      protected var _errorCodeTF:TextField;
      
      protected var _errorCode:String = "";
      
      protected var _width:Number;
      
      protected var _height:Number;
      
      protected function init() : void {
         this._screenBackground = DrawUtil.RectangleSprite(0,0,100,100,0,1,null,0);
         this._card = new Sprite();
         this._background = DrawUtil.RectangleSprite(0,0,CommonUIConstant.NOTICE_CARD_WIDTH,CommonUIConstant.NOTICE_CARD_HEIGHT,0,0.8,null,0);
         this._noticeIcon = AssetUtil.getAsset("Hint_icon2");
         this._errorCodeTF = AssetUtil.getTextField(false);
         this._errorCodeTF.defaultTextFormat = new TextFormat(YaheiFontManager.MICROSOFT_YAHEI,14,16777215);
         this._errorCodeTF.text = "代码：0000";
         addChild(this._screenBackground);
         addChild(this._card);
         this._card.addChild(this._background);
         this._card.addChild(this._noticeIcon);
         this._card.addChild(this._errorCodeTF);
      }
      
      protected function updateLayout() : void {
         var _loc1_:* = NaN;
         var _loc2_:* = NaN;
         var _loc3_:* = NaN;
         if(this._width < CommonUIConstant.NOTICE_CARD_WIDTH || this._height < CommonUIConstant.NOTICE_CARD_HEIGHT)
         {
            _loc2_ = CommonUIConstant.NOTICE_CARD_WIDTH / CommonUIConstant.NOTICE_CARD_HEIGHT;
            _loc3_ = this._width / this._height;
            if(_loc2_ >= _loc3_)
            {
               _loc1_ = this._width / CommonUIConstant.NOTICE_CARD_WIDTH;
            }
            else
            {
               _loc1_ = this._height / CommonUIConstant.NOTICE_CARD_HEIGHT;
            }
            this._card.scaleX = this._card.scaleY = _loc1_;
         }
         else
         {
            this._card.scaleX = this._card.scaleY = 1;
         }
         this._screenBackground.x = this._screenBackground.y = 0;
         this._card.x = this._screenBackground.x + (this._screenBackground.width - this._card.width) / 2;
         this._card.y = this._screenBackground.y + (this._screenBackground.height - this._card.height) / 2;
         this._background.x = this._background.y = 0;
         this._noticeIcon.x = (CommonUIConstant.NOTICE_CARD_WIDTH - this._noticeIcon.width) / 2;
         this._noticeIcon.y = 20;
         this._errorCodeTF.x = (CommonUIConstant.NOTICE_CARD_WIDTH - this._errorCodeTF.textWidth) / 2;
         this._errorCodeTF.y = CommonUIConstant.NOTICE_CARD_HEIGHT - this._errorCodeTF.textHeight - 10;
      }
      
      public function setSize(param1:Number, param2:Number) : void {
         this._width = param1;
         this._height = param2;
         this._screenBackground.width = this._width;
         this._screenBackground.height = this._height;
      }
      
      override public function get width() : Number {
         return this._screenBackground.width;
      }
      
      override public function get height() : Number {
         return this._screenBackground.height;
      }
      
      public function setText(param1:String) : void {
      }
      
      public function setStyle(param1:String) : void {
      }
      
      public function setErrorCode(param1:String) : void {
         if(param1 == null)
         {
            return;
         }
         this._errorCode = param1;
         if(param1 == "")
         {
            this._errorCodeTF.text = "";
         }
         else
         {
            this._errorCodeTF.text = "代码：" + param1;
         }
      }
      
      public function load(param1:String) : void {
      }
   }
}
